//
//  KHHSearchCollectionViewCell.m
//  Travel
//
//  Created by dllo on 15/12/2.
//  Copyright © 2015年 doll. All rights reserved.
//

#import "KHHSearchCollectionViewCell.h"

@interface KHHSearchCollectionViewCell ()
@property (nonatomic, retain)UIButton *btn;
@end

@implementation KHHSearchCollectionViewCell

#pragma mark - 初始化
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.btn = [UIButton buttonWithType:UIButtonTypeSystem];
        self.btn.titleLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:self.btn];
        //    self.btn.backgroundColor = [UIColor grayColor];
        self.btn.layer.masksToBounds = YES;
        self.btn.layer.cornerRadius = 10;
        [ self.btn setTitleColor:[UIColor colorWithRed:0.5 green:0.77 blue:0.8 alpha:1]forState:UIControlStateNormal];
        self.btn.titleLabel.font = [UIFont fontWithName:@"Arial-Bold" size:17];
        self.btn.userInteractionEnabled = NO;
        
        self.btn.layer.borderWidth = .5;
        self.btn.layer.borderColor = [[UIColor colorWithRed:0.3 green:0.74 blue:0.79 alpha:1] CGColor ];
        
    }
    return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    [super applyLayoutAttributes:layoutAttributes];
    
//    //夜间模式
//    if ([[NSUserDefaults standardUserDefaults]boolForKey:@"isNight"]) {
//        self.contentView.backgroundColor = [UIColor colorWithRed:0.28 green:0.28 blue:0.28 alpha:1];
//        self.btn.backgroundColor = [UIColor whiteColor];
//    }else
//    {
//        self.contentView.backgroundColor = [UIColor colorWithRed:0.98 green:0.97 blue:0.93 alpha:1];
//    }
    //标题
    self.btn.frame = CGRectMake(0, 0, layoutAttributes.size.width, layoutAttributes.size.height);
    
    // self.btn.alpha = 0.5;
}


- (void)setModel:(KHHRecommendModel *)model
{
    _model = model ;
    [self.btn setTitle:self.model.name forState: UIControlStateNormal];
    
}

@end
